package org.example.service;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.example.config.MapperConfig;
import org.example.domain.Employee;

import java.io.IOException;
import java.util.List;

public class EmployeeService {
    private SqlSessionFactory sqlSessionFactory;

    public EmployeeService() throws IOException {
        sqlSessionFactory = new MapperConfig().useMapper("applicationContext.xml");
    }

    public List<Employee> findEmployAll() {
        SqlSession sqlSession = sqlSessionFactory.openSession();
        List<Employee> list = sqlSession.selectList("findEmpAll");
        sqlSession.close();
        return list;
    }
}
